﻿using UnityEngine;
using System.Collections;

public class MoveTrigger : MonoBehaviour {
    public Transform CurrentBg;
    public Pipe Pipe1;
    public Pipe Pipe2;
    public void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            Transform firstBg = GameSvc.Instance.FirstBg;
            CurrentBg.position = new Vector3(firstBg.position.x + 5.5f, firstBg.position.y, firstBg.position.z);
            GameSvc.Instance.FirstBg = CurrentBg;
            Pipe1.RandomGeneratePosition();
            Pipe2.RandomGeneratePosition();
        }
    }
	
}
